Skip to content

Auto-approve workflow for code flow PRs#37924

Open
roji wants to merge 1 commit intodotnet:mainfrom
roji:AutoMergeCodeFlow
Open

Auto-approve workflow for code flow PRs#37924
roji wants to merge 1 commit intodotnet:mainfrom
roji:AutoMergeCodeFlow

Conversation

@roji
Copy link
Member

@roji roji commented Mar 14, 2026

This is a proposal to automate approval of maestro-bot codeflow PRs; we currently manually scan and approve these, and human attention really has no added value here. We do this several times a day.

  • Runs only for PRs opened by maestro-bot
  • Approves only if the PR only modifies files in a closed allow list; any other file causes the workflow to exit without approving
  • Similarly, updates within the allowed files must match a specific set of patterns, otherwise we skip approval

@AndriySvyryd if this makes sense to you, maybe we can check with the codeflow infra people to make sure they don't have objections etc. But I really don't see what you and I bring to the table that this workflow cannot do.

@roji roji marked this pull request as ready for review March 14, 2026 05:54
@roji roji requested a review from a team as a code owner March 14, 2026 05:54
Copilot AI review requested due to automatic review settings March 14, 2026 05:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a GitHub Actions workflow to automatically approve dependency/codeflow PRs opened by dotnet-maestro[bot], based on a strict allowlist of files and line-level diff validation patterns.

Changes:

  • Introduces .github/workflows/auto-approve-codeflow.yml to validate PR diffs (allowed files + regex patterns) and auto-approve when they match.
  • Uses gh pr diff to inspect changes and gh pr review --approve to submit the approval.

You can also share your feedback on Copilot code review. Take the survey.

@roji roji force-pushed the AutoMergeCodeFlow branch from 8a47fe4 to aca342c Compare March 14, 2026 06:18
| "NuGet.config"):
files_seen.add(current_file)
case _:
errors.append(f"Unexpected file: {current_file}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files under eng/common/ should be fine as well

if errors:
for e in errors:
print(f"::notice::{e}")
print("::notice::Skipping auto-approve – PR contains unexpected changes")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should add a comment mentioning @dotnet/efteam on the PR

@AndriySvyryd
Copy link
Member

FYI @wtgodbe @ViktorHofer

@wtgodbe
Copy link
Member

wtgodbe commented Mar 17, 2026

It might be simpler to do this with policybot - we already do that in aspnetcore: https://github.com/dotnet/aspnetcore/blob/ab2e33a05f53406a5125b8971a6e5af6b35ff448/.github/policies/resourceManagement.yml#L267-L288

@AndriySvyryd AndriySvyryd assigned roji and unassigned AndriySvyryd Mar 17, 2026
@ViktorHofer
Copy link
Member

I think that's against policy. Every PR needs a human approval. @mmitche you might have more details on this.

@mmitche
Copy link
Member

mmitche commented Mar 17, 2026

Yeah, we shouldn't be auto-approving these. In addition, a workflow is not a great way to do this since it can be broken by some simple changes to Actions at the org level.

@roji
Copy link
Member Author

roji commented Mar 17, 2026

I'm very open for doing this in other ways, but I'd really like us to at least automate these pure dependency flow PRs specifically; I honestly am not sure what a human is supposed to do beyond what what this workflow does exactly - the proposed workflow filters for the exact changes that dependency flow does, in the exact files and nodes, etc. etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants